using System;
using System.Text;
using Com.ContentRendering.Api.ParserEngine.Exceptions;

namespace Com.ContentRendering.Api.ParserEngine.State
{
    /// <summary/>
    internal class EscapeState : AbstractState
    {
        /// <summary/>
        internal EscapeState(AbstractState state) : base(state) { }
        
        /// <summary/>
        protected override void ParseEscapeCharacter()
        {
            base._outputNode.AddContent(this._documentParser.SpecialCharacters.Escape.ToString());

            // the state needs to be updated
            base._documentParser.State = new ContentState(this);
        }

        /// <summary/>
        protected override void ParseStartCharacter()
        {
            base._outputNode.AddContent(this._documentParser.SpecialCharacters.Start.ToString());

            // the state needs to be updated
            base._documentParser.State = new ContentState(this);
        }

        /// <summary/>
        protected override void ParseEndCharacter()
        {
            base._outputNode.AddContent(this._documentParser.SpecialCharacters.End.ToString());

            // the state needs to be updated
            base._documentParser.State = new ContentState(this);
        }

        /// <summary/>
        protected override void ParseIfCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseIfNotCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseSubstitutionCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseTransparentCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseParentCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseChildCharacter()
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void ParseOtherCharacter(char value)
        {
            throw new MissingEscapeCharacterException();
        }

        /// <summary/>
        protected override void EndHandler()
        {
            throw new MissingEscapeCharacterException();
        }
    }
}
